/*
 * @author: pwz（潘文周）
 * @description: 
 */
import Vue from 'vue'
import VueRouter from 'vue-router'
import Base from '@/views/Base.vue'

Vue.use(VueRouter)

const routes = [
  {
  path: '/',
  name: 'base',
  component: Base,
  children: []
},
//TODO:对接单点登录
// {
//   path: '/login',
//   name: 'Login',
//   component: Login,
//   children: []
// },

// {
//   path: '/large',
//   name: 'large',
//   meta: {
//       title: "large",
//       requireAuth: true, // 进入路由需登录
//   },
//   component: resolve => {
//       require(['@/views/components/large/index.vue'], resolve);
//   },
  // children: [{
  //     path: '/large/landstore',
  //     name: 'home',
  //     meta: {
  //         requireAuth: true,
  //         title: "房屋普查统计"
  //     },
  //     component: resolve => {
  //         require(['@/views/components/large/landstore/landstore.vue'], resolve);
  //     },
  // }
  // ]
// },
// {
//   path: '*',
//   redirect: '/',
//   meta: {
//     keepAlive: true
//   }
// }
]

const router = new VueRouter({
  // mode: 'history',
  base: process.env.BASE_URL,
  routes
})
export function resetRouter(){
  router.matcher = new VueRouter({
    routes: []
  }).matcher
}

const routerPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return routerPush.call(this, location).catch(error => error)
}

export default router
